package com.ibm.sand.rt.index;

import java.util.concurrent.TimeUnit;

public class TempIndexRefreshner implements Runnable {
	// TODO: turn into a scheduled task
	private static final long	REFRESH_RATE_MS	= TimeUnit.SECONDS.toMillis(5);

	@Override
	public void run() {
		while (!Thread.interrupted()) {
			try {
				Thread.sleep(REFRESH_RATE_MS);
				IndexManager.INSTANCE.refreshReaders();
			} catch (final InterruptedException e) {
				Thread.currentThread().interrupt();
			} catch (final Exception e) {
				throw new RuntimeException(e);
			}
		}

	}

}
